/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gestionform;

import dao.exception.DAOConnectionException;
import dao.exception.DAONoteException;
import dao.interfaces.DAONote;
import model.Note;

/**
 *
 * @author Paul
 */
public class GestionNote extends GestionInfos {

    private final DAONote daoNote;

    public GestionNote(DAONote daoNot) {
        this.daoNote = daoNot;
    }

    public void affecterNote(String cours, String examen, String etudiant, String note) {
        try {
            daoNote.create(Float.parseFloat(note), Integer.parseInt(etudiant), Integer.parseInt(examen));
            resultat = "La note a bien été affecté à l'étudiant";
        } catch (DAONoteException daoEx) {
            resultat = daoEx.getMessage();
        } catch (DAOConnectionException daocEx) {
            resultat = daocEx.getMessage();
        }
    }

    public Note getNoteEtudiantExamen(int idEtud, int idExam) {
        Note note = null;
        try {
            note = daoNote.findNoteEtudiantExam(idEtud, idExam);
        } catch (DAONoteException daoEx) {
            resultat = daoEx.getMessage();
        } catch (DAOConnectionException daocEx) {
            resultat = daocEx.getMessage();
        }
        return note;
    }
}
